<template>
  <div class="">
    <el-tabs type="border-card">
      <el-tab-pane label="全部 ">
        <a href="javascript:;" style="color: #22a0ff; float: right; margin-bottom: 10px;">全部设为已读</a>
        <el-table
            :data="tableData"
            border
            tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange">
            <el-table-column
              type="selection"
              width="55">
            </el-table-column>
            <el-table-column
              fixed
              prop="date"
              label="日期"
              width="150">
            </el-table-column>
            <el-table-column
              prop="name"
              label="姓名"
              width="120">
            </el-table-column>
            <el-table-column
              prop="province"
              label="省份"
              width="120">
            </el-table-column>
            <el-table-column
              prop="city"
              label="市区"
              width="120">
            </el-table-column>
            <el-table-column
              prop="address"
              label="地址"
              width="300">
            </el-table-column>
            <el-table-column
              prop="zip"
              label="邮编"
              width="120">
            </el-table-column>
            <el-table-column
              fixed="right"
              label="操作"
              width="130">
              <template slot-scope="scope">
                <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
                <el-dropdown>
                  <span class="el-dropdown-link">
                      <el-button type="text" size="small">更多</el-button>
                      <i class="el-icon-caret-bottom" style="color: #20a0ff"></i>
                  </span>
                  <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item>
                          设为已读
                      </el-dropdown-item>
                      <el-dropdown-item>
                          删除
                      </el-dropdown-item>
                  </el-dropdown-menu>
              </el-dropdown>

              </template>
            </el-table-column>
          </el-table>
      </el-tab-pane>
      <el-tab-pane label="未读 ">
          未读消息
      </el-tab-pane>

      <!-- 页码 -->
      <div class="block" style="margin: 20px 0;">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalNum">
          </el-pagination>
      </div>

    </el-tabs>






  </div>
</template>

<script>
  export default {
    data() {
      return {
        total: {
            page: null,
            num: null
        },

        totalNum: null,
        index: null,
        currentPage: 1,
        tableData: [{
          date: '2016-05-03',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '2016-05-02',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '2016-05-04',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '2016-05-01',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }],
        multipleSelection: []
      }
    },

    methods: {
      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
       handleClick(row) {//查看
        console.log(row);
      },
      handleSizeChange(val) {
          console.log(`每页 ${val} 条`);
          this.pageSize = val
          this.getData(this.date)

      },
      handleCurrentChange(val) {
          this.currentPage = val
          console.log(`当前页: ${val}`);
          this.getData(this.date)
      },
    }
  }
</script>